home *** CD-ROM | disk | FTP | other *** search
- #include "tmp/libpq-fs.h"
- #include <sys/file.h>
-
- extern char *PQexec();
-
- void main(argc,argv)
- int argc;
- char *argv[];
- {
- int fd;
- int cnt, total = 0;
- char *buf;
- int blen;
- char *res;
- extern char *getenv();
-
- PQsetdb(getenv("USER"));
- blen=atoi(argv[2]);
- buf = (char *)malloc(blen);
-
- res = PQexec("begin");
- fd = p_open(argv[1],O_RDONLY);
- printf("%d fd\n",fd);
- while ((cnt = p_read(fd,buf,blen)) > 0) {
- printf ("%d\n",cnt);
- total += cnt;
- printf ("%d total\n",total);
- }
- p_close(fd);
- res = PQexec("end");
- PQfinish();
- }
-